home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Scene Storm
/
Scene Storm - Volume 1.iso
/
coding
/
c
/
hello_localized
/
hello3.asm
< prev
next >
Wrap
Assembly Source File
|
1995-09-01
|
2KB
|
113 lines
AbsExecBase equ 4
_LVOOldOpenLibrary equ -408
_LVOOpenLibrary equ -552
_LVOCloseLibrary equ -414
_LVOOutput equ -$3C
_LVOWrite equ -$30
MSG_HELLO equ 0
LF equ 10
CALL macro
jsr _LVO\1(a6)
endm
section main,code
*-------------- Startup...
Begin: lea _Catalog(pc),a4 ;DT Area...
move.l (AbsExecBase).w,a6
lea DOSName(pc),a1
CALL OldOpenLibrary ;open dos (any ver)
move.l d0,_DOSBase-DT(a4)
move.l d0,a6
CALL Output ;get output
move.l d0,_Output-DT(a4)
lea LocaleName(pc),a1
moveq #38,d0 ;version 38+
move.l (AbsExecBase).w,a6
CALL OpenLibrary ;open locale
move.l d0,_Locale-DT(a4)
beq.s no_local
lea CatalogName(pc),a1 ;name of catalog
suba.l a0,a0 ;no tags or lang
suba.l a2,a2
move.l d0,a6
jsr -$96(a6) ;open catalog
move.l d0,_Catalog-DT(a4)
no_local:
*-------------- Example call...
lea HelloWorld.txt(pc),a0 ;default string
moveq #MSG_HELLO,d0 ;string.no in catalog
bsr.s _PutStr
*-------------- Shutdown...
move.l (a4),d0 ;_Catalog-DT(a4),d0
beq.s CloseLocale
move.l d0,a0
move.l _Locale-DT(a4),a6
jsr -$24(a6) ;close catalog
CloseLocale: move.l _Locale-DT(a4),d0
beq.s CloseDos
move.l d0,a1
move.l (AbsExecBase).w,a6
CALL CloseLibrary ;close locale
CloseDos: move.l _DOSBase-DT(a4),d0
beq.s ExitCLI
move.l d0,a1
move.l (AbsExecBase).w,a6
CALL CloseLibrary ;close dos
ExitCLI: moveq #0,d0 ;return 0 for cli..
rts
******************************************************************************
* PutStr
* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
******************************************************************************
_PutStr: move.l d0,d7
move.l a0,a1
move.l (a4),a0 ;_Catalog-DT(a4),a0
move.l d7,d0
move.l _Locale-DT(a4),a6
jsr -$48(a6) ;GetLocaleStr
move.l d0,d6
move.l d0,a0
.strlen: tst.b (a0)+ ;get string length
bne.s .strlen
subq.l #1,a0
sub.l d0,a0
move.l a0,d3
move.l _Output-DT(a4),d1
move.l d6,d2
move.l _DOSBase-DT(a4),a6
jsr _LVOWrite(a6) ;write to cli..
rts
DT:
_Catalog: ds.l 1
_Locale: ds.l 1
_DOSBase: ds.l 1
_Output: ds.l 1
DOSName: dc.b 'dos.library',0
even
LocaleName: dc.b 'locale.library',0
even
CatalogName: dc.b 'hello.catalog',0
even
HelloWorld.txt: dc.b 'Hello World!',LF,0
even